package com.nine.pesys.model.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * 设备基本信息(静态)
 * Created by L先森 on 2014/12/20.
 */
@Entity
@Table(name = "tb_equipment")
public class Equipment implements Serializable{

    private Long id;
    private Float price;
    private String name;
    private Long totalNum;
    private Long leftNum;
    private Set<EquipmentDetail> equipmentDetails = new HashSet<EquipmentDetail>();

    @Id
    @Column(name = "id",length = 10)
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(Long totalNum) {
        this.totalNum = totalNum;
    }

    @Column
    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    @Column
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column
    public Long getLeftNum() {
        return leftNum;
    }

    public void setLeftNum(Long leftNum) {
        this.leftNum = leftNum;
    }

    @OneToMany(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
    @JoinColumn(name = "equipmentId")
    public Set<EquipmentDetail> getEquipmentDetails() {
        return equipmentDetails;
    }

    public void setEquipmentDetails(Set<EquipmentDetail> equipmentDetails) {
        this.equipmentDetails = equipmentDetails;
    }
}
